unit ItemsUnit;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls, CheckLst;

type

  { TItemsForm }

  TItemsForm = class(TForm)
    btnOK: TButton;
    CheckListBox1: TCheckListBox;
    Edit1: TEdit;
    procedure btnOKClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end; 

var
  ItemsForm: TItemsForm;
  StringsOfEnabledItems,  StringsOfAllThisItems: TStringList;
  ClickedGroupName: string;

implementation

{ TItemsForm }

procedure TItemsForm.FormCreate(Sender: TObject);
var i : integer;
begin
  ItemsForm.Caption:='Список групп';
  Edit1.Text:=ClickedGroupName;
 { CheckListBox1.Clear; {????}} //При создании она и так пустая
  StringsOfAllThisItems:=TStringList.Create;
  StringsOfAllThisItems.LoadFromFile('ListData');

  For i:=0 to StringsOfAllThisItems.Count-1 do
  begin
    If (copy(Edit1.Text, 1, 3) = copy(StringsOfAllThisItems.Strings[i] , 1, 3))
    then
    begin
      CheckListBox1.Items.Add(copy(StringsOfAllThisItems.Strings[i], 1,
       pos(' ', StringsOfAllThisItems.Strings[i])) ) ;
    end;
  end; {for}

  StringsOfAllThisItems.Free;

end;

procedure TItemsForm.btnOKClick(Sender: TObject);
var i:integer;
begin
     ItemsForm.ModalResult:=mrOk;
end;

initialization
  {$I itemsunit.lrs}

end.

